package com.neusoft.springboot01.controller;

import com.neusoft.springboot01.domain.Emp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class HelloController01 {

    @GetMapping("/hello01")
    public String getHello()
    {
       return "hello12312312";
    }

    @GetMapping("/getEmp.do")
    public Emp getEmpObj()
    {
        Emp emp = new Emp(1,"掌声","￥23423");
        return emp;
    }

    @GetMapping("/getList.do")
    public List<Emp> getListEmp()
    {
        List<Emp> list = Arrays.asList(
                new Emp(1,"掌声1","￥23423"),
                new Emp(2,"掌声2","￥23423"),
                new Emp(3,"掌声3","￥23423"),
                new Emp(4,"掌声4","￥23423"),
                new Emp(5,"掌声5","￥23423")
        );
        return list;
    }

    @GetMapping("/getMap.do")
    public Map<String,Object> getMapEmp()
    {
        List<Emp> list = Arrays.asList(
                new Emp(1,"掌声1","￥23423"),
                new Emp(2,"掌声2","￥23423"),
                new Emp(3,"掌声3","￥23423"),
                new Emp(4,"掌声4","￥23423"),
                new Emp(5,"掌声5","￥23423")
        );
        Map<String,Object> map = new HashMap<>();
        map.put("code",200);
        map.put("message","业务执行成功！！！");
        map.put("data",list);

        return map;
    }
}
